package top.tocchen.bookshop.util;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;


/**
 * @author tocchen
 * @date 2022-5-30 12:55
 * 使用JDK 1.8 中的时间工具类实现
 */
public class DateFormat {

    private static DateTimeFormatter matter = DateTimeFormatter.ofPattern("yyyy-MM-dd");

    @Deprecated
    public static String formatDateToDay(Date date){
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String dateTime=df.format(date);
        return dateTime;
    }

    public static String Date2String(LocalDate date){
        return matter.format(date);
    }
}
